var toTop = document.querySelector("#toTop");
//判断滚动条然后隐藏按钮
window.onscroll = function(){
    //获取滚动条距离顶部的距离
    //判断距离是否隐藏按钮
    if(document.documentElement.scrollTop>694||document.body.scrollTop>694){
        toTop.style.display="block";
    }else {
        toTop.style.display="none";
    }
};

//鼠标回到顶部的代码
toTop.addEventListener("click",function(){
   /* 这个是秒回顶部的*/window.scrollTo(0,0);

    //这个是过渡回到顶部的事件
    /*window.scrollTo({
        top: 0,
        behavior: 'smooth'
    });*/
});

//导航选项卡
var fenlei_btn = document.querySelector("#fenlei_btn");
var fenlei_text = document.querySelector("#fenlei_text");

fenlei_btn.addEventListener("mouseover",function(){
   fenlei_text.style.display = "block";
});
fenlei_btn.addEventListener("mouseleave",function(){
    fenlei_text.style.display = "none";
});
fenlei_text.addEventListener("mouseover",function(){
    fenlei_text.style.display = "block";
});
fenlei_text.addEventListener("mouseleave",function(){
    fenlei_text.style.display = "none";
});

//动态点赞
var lang = 'zh';
var bb1 = document.querySelector("#dianzan").innerHTML; bb1 = Number(bb1);
function htd(){
    if(lang == 'zh'){
        lang = 'en';
    }else{
        lang = 'zh';
    }
    if(lang == 'en'){
        document.querySelector("#dianzan").innerHTML=bb1+1;
    }else {
        document.querySelector("#dianzan").innerHTML=bb1;
    }
}
var cc1 = document.querySelector("#shoucang").innerHTML; cc1 = Number(cc1);
function htn(){
    if(lang == 'zh'){
        lang = 'en';
    }else{
        lang = 'zh';
    }
    if(lang == 'en'){
        document.querySelector("#shoucang").innerHTML=cc1+1;
    }else {
        document.querySelector("#shoucang").innerHTML=cc1;
    }
}

//var b = [true, true, true, true, true, true];
//function htd(t){
//    console.log(t.innerHTML);
//    var kk = t.innerHTML = Number(t.innerHTML);
//    if(b == true){
//        t.innerHTML = Number(t.innerHTML)+1;
//
//    }else {
//        t.innerHTML = Number(t.innerHTML)-1;
//    }
//

////轮播图
var mySwiper = new Swiper ('.swiper-container', {
    loop: true, // 循环模式选项
    autoplay:true,
    pagination: {// 如果需要分页器
        el: '.swiper-pagination',
        clickable:true,
    },
    navigation: {// 如果需要前进后退按钮
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    }
});
